let BARCode = require("./barcode");
let QRCode = require("./qrcode");

function convert_length(length) {
	return Math.round(uni.getSystemInfoSync().windowWidth * length / 750);
}

function barCode(id, that, code, width, height) {
	console.log("barCode", id)
	BARCode.code128(uni.createCanvasContext(id, that), code, convert_length(width), convert_length(height))
}

function qrCode(id, that, code, width, height) {
	console.log("qrCode", id)
	QRCode.api.draw(code, {
		ctx: uni.createCanvasContext(id, that),
		width: convert_length(width),
		height: convert_length(height)
	})
}

export {
	barCode,
	qrCode
}
